<?php
error_reporting(E_ALL|E_STRICT); 
ini_set('display_errors', true);
date_default_timezone_set('Asia/Shanghai');
$rootDir = dirname(dirname(__FILE__));

set_include_path('.' . PATH_SEPARATOR . './library'
	. PATH_SEPARATOR . './application/models/'
	. PATH_SEPARATOR . get_include_path());

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Debug');
Zend_Loader::loadClass('Zend_Controller_Front');
Zend_Loader::loadClass('Zend_Db');
Zend_Loader::loadClass('Zend_Db_Table');
Zend_Loader::loadClass('Zend_Config_Ini');
Zend_Loader::loadClass('Zend_Registry');

//Load configuration
$config = new Zend_Config_Ini('./application/config.ini','general');
$registry = Zend_Registry::getInstance();
$registry->set('general_config',$config);

//connect to db
$db = Zend_Db::factory($config->db->adapter,$config->db->config->toArray());
Zend_Db_Table::setDefaultAdapter($db);
$db->query("SET NAMES 'utf8'");      

// setup controller
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$frontController->setControllerDirectory('./application/controllers');
// run!
$frontController->dispatch();
?>